package com.goatrock.media.thisway.domain.filter.impl;

import com.goatrock.media.thisway.common.constants.ApplicationConstants;
import com.goatrock.media.thisway.common.model.Title;
import com.goatrock.media.thisway.domain.filter.TitleFilter;
import java.util.Map;

public class GenreFilterImpl implements TitleFilter{
    private String folderName = "Genres";
    private String name = "Genres";
    private String description = "Creates a folder for each genre and places a shortcut for every title that has that genre in that folder.";

    public String[] execute(Map shortcutParams, Title title) {
        if(title != null && title.getGenres() != null){

            String[] genres = title.getGenres();
            for(int i=0;i<genres.length;i++){
                genres[i] = this.folderName+"\\"+genres[i];
            }
            return genres;
        }
        return null;
    }

    public boolean isExecutable(Map shortcutParams){
        String createGenres = (String)shortcutParams.get(ApplicationConstants.CREATE_GENRES);
        if(createGenres != null && createGenres.equalsIgnoreCase(ApplicationConstants.PARAM_USE)){
            return true;
        }
        return false;
    }

    public String getFolderName(){
        return this.folderName;
    }

    public String getName() {
        return this.name;
    }

    public String getDescription() {
        return this.description;
    }

}
